﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace ThinControlLibrary.Classes
{
    public class MultiplicationConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {

            double val = System.Convert.ToDouble(value);
            double par = System.Convert.ToDouble(parameter);
            return val * par;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double val = System.Convert.ToDouble(value);
            double par = System.Convert.ToDouble(parameter);
            return val / par;
        }
    }
    public class CoefficientConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {

            double val = System.Convert.ToDouble(value);
            double par = System.Convert.ToDouble(parameter);
            return val + par * val;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double val = System.Convert.ToDouble(value);
            double par = System.Convert.ToDouble(parameter);
            return val / (1 + par);
        }
    }
}
